<template>
  <div class='setting'>
    <van-nav-bar
      title="设置"
      left-arrow
      @click-left="$router.back()"
    />
    <div class="setting user-setting" v-if="token">
      <van-cell title="编辑资料" is-link @click="$router.push('/setting/profile')"/>
      <van-cell title="账号安全" is-link @click="$router.push('/setting/account')"/>
      <van-cell title="隐私设置" is-link @click="$router.push('/setting/privacy')"/>
    </div>
    <div class="setting basic-setting">
      <van-cell title="夜间模式" >
        <template #right-icon>
        <van-switch v-model="checked" size="20px"/>
        </template>
      </van-cell>
      <van-cell title="大字设置" is-link />
      <van-cell title="字体大小" is-link value="小" />
    </div>
    <div class="setting">
      <van-cell title="清除缓存" is-link value="0B" />
      <van-cell title="播放与网络设置" is-link />
      <van-cell title="推送通知设置" is-link />
      <van-cell title="安全浏览设置" is-link />
      <van-cell title="提示音开关" >
        <template #right-icon>
          <van-switch v-model="checked" size="20px"/>
        </template>
      </van-cell>
    </div>
    <div class="setting">
      <van-cell title="隐私政策及简明版" is-link />
      <van-cell title="个人信息收集清单" is-link />
      <van-cell title="第三方信息共享清单" is-link />
      <van-cell title="安全浏览设置" is-link />
    </div>
    <div class="setting">
      <van-cell title="检查版本" is-link value="1.0.0" />
      <van-cell title="关于头条" is-link />
      <van-cell title="用户反馈" is-link />
    </div>
    <div class="login-out" v-if="token">
      <van-button type="default" block @click="onExit()">退出登录</van-button>
    </div>
   </div>
</template>

<script>
import { mapActions, mapGetters } from 'vuex'
export default {
  name: 'Setting',
  components: {
  },
  data () {
    return {
      checked: true
    }
  },
  computed: {
    ...mapGetters(['token'])
  },
  created () {
  },
  methods: {
    ...mapActions('user', ['logout']),
    onExit () {
      this.logout()
      this.$router.back()
    }
  }
}
</script>
<style lang="scss" scoped>
.setting{
  text-align: left;
  background-color:rgb(240, 240, 240);

}
.setting{
  margin-top: 8px;
}
.login-out{
  margin-top: 15px;
  .van-button--default {
    color: #5881e0;
}
}
</style>
